package swust;
import java.util.Scanner;
import java.util.LinkedList;
public class InverseNumber0036 {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		LinkedList<Integer> array = new LinkedList<Integer>();
		LinkedList<Integer> stack = new LinkedList<Integer>();
		while (n > 0) {			
			array.push(n%10);
			n /= 10;
		}
		System.out.println(array.size());
		while(!array.isEmpty()) {
			stack.push(array.pop());
			System.out.print(stack.peek());
			if(!array.isEmpty()) {
				System.out.print(" ");
			}
		}
		System.out.println();
		while(!stack.isEmpty()) {
			System.out.print(stack.pop());
		}
		System.out.println();
	}
}
